#ifndef SAMPLE_CUBE_H
#define SAMPLE_CUBE_H

#include "BaseSample.h"
#include <detail/type_mat.hpp>
#include <detail/type_mat4x4.hpp>

static GLfloat cubeVertices[] = {
        -1.0f,1.0f,1.0f,    //正面左上0
        -1.0f,-1.0f,1.0f,   //正面左下1
        1.0f,-1.0f,1.0f,    //正面右下2
        1.0f,1.0f,1.0f,     //正面右上3
        -1.0f,1.0f,-1.0f,    //反面左上4
        -1.0f,-1.0f,-1.0f,   //反面左下5
        1.0f,-1.0f,-1.0f,    //反面右下6
        1.0f,1.0f,-1.0f,     //反面右上7
};
static GLfloat *cubeColorVertices = new GLfloat[] {
        0.0f,1.0f,0.0f,1.0f,
        0.0f,1.0f,0.0f,1.0f,
        0.0f,1.0f,0.0f,1.0f,
        0.0f,1.0f,0.0f,1.0f,
        1.0f,0.0f,1.0f,1.0f,
        1.0f,0.0f,1.0f,1.0f,
        1.0f,0.0f,1.0f,1.0f,
        1.0f,0.0f,1.0f,1.0f,
};
static GLshort cubeIndexs[]={
        6,7,4,6,4,5,    //后面
        6,3,7,6,2,3,    //右面
        6,5,1,6,1,2,    //下面
        0,3,2,0,2,1,    //正面
        0,1,5,0,5,4,    //左面
        0,7,3,0,4,7,    //上面
};

class SampleCube : public BaseSample
{
public:
    SampleCube();
    ~SampleCube();

    virtual void LoadImage(NativeImage *pImage);

    virtual void Init();

    virtual void Draw();

    virtual void Destroy();

    virtual void setParentViewSize(int w, int h);
    virtual void OnSurfaceCreated();
    virtual void OnSurfaceChanged(int width, int height);

    void UpdateMVPMatrix(glm::mat4 &mvpMatrix, int angleX, int angleY, float ratio);

protected:
    GLint m_MVPMatLoc;
//    glm::mat4 m_MVPMatrix;

    int m_AngleX;
    int m_AngleY;
    float m_ScaleX;
    float m_ScaleY;

private:
    glm::mat4 m_MVPMatrix;
};


#endif